function [lefts_new,rights_new]= crossover(lefts,rights,total_op_num)
global   num_job num_op;
chroms1=lefts;
chroms2=rights;
for i=1:size(chroms1,1)
    parent1=lefts(i,:);
    parent2=rights(size(chroms1,1)-i+1,:);
    Job=randperm(num_job);
    J1=Job(1:round(num_job/2));
    J2=Job(length(J1)+1:end);
    op_p1=[];
    op_p2=[];
    if ~isempty(length(J2))
        for j=1:length(J2)
            op_p1=[op_p1,find(parent1(1:total_op_num)==J2(j))];
            op_p2=[op_p2,find(parent2(1:total_op_num)==J2(j))];
        end
        op_s1=sort(op_p1);
        op_s2=sort(op_p2);
        chroms1(i,op_s1)=parent2(op_s2);
        chroms1(i,total_op_num+op_s1)=parent2(total_op_num+op_s2);
        chroms1(i,total_op_num*2+op_s1)=parent2(total_op_num*2+op_s2);
        chroms2(size(chroms1,1)-i+1,op_s2)=parent1(op_s1);
        chroms2(size(chroms1,1)-i+1,total_op_num+op_s2)=parent1(total_op_num+op_s1);
        chroms2(size(chroms1,1)-i+1,total_op_num*2+op_s2)=parent1(total_op_num*2+op_s1);
    end
end
rights_new=chroms1;
lefts_new=chroms2;
chroms1=lefts;
chroms2=rights;
for i=1:size(chroms1,1)
    parent1=lefts(size(chroms1,1)-i+1,:);
    parent2=rights(i,:);
    rand0_1=randi([0,1],1,total_op_num);
    temp=1;
    for n=1:num_job
        ind_0=find(rand0_1(temp:temp+num_op(n)-1)==0);  
        temp=temp+num_op(n);
        if ~isempty(ind_0)
            ind1=find(parent1(1:total_op_num)==n);
            ind2=find(parent2(1:total_op_num)==n);
            chroms1(size(chroms1,1)-i+1,total_op_num+ind1(ind_0))=parent2(total_op_num+ind2(ind_0));
            chroms1(size(chroms1,1)-i+1,total_op_num*2+ind1(ind_0))=parent2(total_op_num*2+ind2(ind_0));
            chroms2(i,total_op_num+ind2(ind_0))=parent1(total_op_num+ind1(ind_0));
            chroms2(i,total_op_num*2+ind2(ind_0))=parent1(total_op_num*2+ind1(ind_0));
        end
    end
end
rights_new=[rights_new;chroms1];
lefts_new=[lefts_new;chroms2];
